/**
 * 自定义组件
 */
var likeComponent =  {
    template: '#likeTpl',
    data : function(){
        return {
            count : 0,
            liked :false,
            active : false
        }
        
    },
    methods: {
        onToggle : function(){
            if (!this.liked){
                this.count ++ 
            } else {
                this.count --
            }
            this.active = !this.active
            this.liked = !this.liked
        }
    }
}

var app = new Vue({
    el : "#app",
    components :{
        like : likeComponent
    }
})